package com.zmn.plat.common.dictionary;

/**
 * 故障类型枚举
 *
 * @author linfeng
 * @since 2019/11/25 14:56:30
 */
public enum ItemCategoryEnum {

    /**
     * values
     */
    NULL(0, "其他"),
    NORMAL_FAULT(1000, "普通故障"),
    OTHER_SERVICES(1001, "其他服务"),
    SPECIAL_FAULT(1002, "特殊故障"),
    MATERIAL_COST(1003, "材料费"),
    VALUE_ADD_SERVICE(1004, "增值服务"),
    SERVICE_CHARGE(1005, "服务收费"),
    ;

    private Integer code;
    private String name;

    ItemCategoryEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ItemCategoryEnum of(Integer code) {
        if (code == null || code == 0) {
            return NULL;
        }
        switch (code) {
            case 1000:
                return NORMAL_FAULT;
            case 1001:
                return OTHER_SERVICES;
            case 1002:
                return SPECIAL_FAULT;
            case 1003:
                return MATERIAL_COST;
            case 1004:
                return VALUE_ADD_SERVICE;
            case 1005:
                return SERVICE_CHARGE;
            default:
                return NULL;
        }
    }
}
